import request from '@/utils/request'
import { httpAxios } from '../utils/request';
let OrderApi = {
  /*订单列表*/
  orderlist(data, errorback) {
    return request._postBody('/shop/order/order/index', data, errorback);
  },
  /*订单列表*/
  orderExpress(data, errorback) {
    return request._postBody('/shop/order/order/express', data, errorback);
  },
  /*订单详情*/
  orderdetail(data, errorback) {
    return request._post('/shop/order/order/detail', data, errorback);
  },
  /*售后管理*/
  orderrefund(data, errorback) {
    return request._postBody('/shop/order/refund/index', data, errorback);
  },
  /*去发货*/
  delivery(data, errorback) {
    return request._postBody('/shop/order/order/delivery', data, errorback);
  },
  /*确认审核*/
  confirm(data, errorback) {
    return request._postBody('/shop/order/operate/confirmCancel', data, errorback);
  },
  /*售后详情*/
  refundDetail(data, errorback) {
    return request._get('/shop/order/refund/detail', data, errorback);
  },
  /*售后审核*/
  Approval(data, errorback) {
    return request._postBody('/shop/order/refund/audit', data, errorback);
  },
  //收货审批 
  ShAudit(data, errorback) {
    return request._postBody('/shop/order/refund/delivery/audit', data, errorback);
  },
  //财务审批
  cwAudit(data, errorback) {
    return request._postBody('/shop/order/refund/receipt', data, errorback);
  },


  /*确认收货并退款*/
  receipt(data, errorback) {
    return request._postBody('/shop/order/refund/receipt', data, errorback);
  },
  /*核销*/
  extract(data, errorback) {
    return request._postBody('/shop/order/operate/extract', data, errorback);
  },
  /*修改价格*/
  updatePrice(data, errorback) {
    return request._postBody('/shop/order/order/updatePrice', data, errorback);
  },
  /*批量发货*/
  batchDelivery(formData, errorback) {
    return request._upload('/shop/order/operate/batchDelivery', formData, errorback);
  },
  /*取消订单*/
  orderCancel(formData, errorback) {
    return request._postBody('/shop/order/order/orderCancel', formData, errorback);
  },
  /*虚拟商品发货*/
  virtual(formData, errorback) {
    return request._postBody('/shop/order/order/virtual', formData, errorback);
  },
  updateAddress(data, errorback) {
    return request._postBody('/shop/order/order/updateAddress', data, errorback);
  },
  /*导出*/
  operateExport(data, errorback) {
    return request._getBody('/shop/order/operate/export', data, errorback);
  },
  /*微信订单发货信息录入*/
  wxDelivery(data, errorback) {
    return request._post('/shop/order/order/wxDelivery', data, errorback);
  },
  /*电子面单取消*/
  labelCancel(data, errorback) {
    return request._post('/shop/order/order/labelCancel', data, errorback);
  },
  /*电子面单复打*/
  printOld(data, errorback) {
    return request._post('/shop/order/order/printOld', data, errorback);
  },
  getOrderDetail(orderId, errorback) {
    return request._post('/shop/order/order/detail?orderId=' + orderId, {}, errorback);
  },
  // 变更记录详情
  getmodifyIdDetail(orderId, errorback) {
    return request._get('/shop/order/order/modify/detail?modifyId=' + orderId, {}, errorback);
  },
  // 去发货
  toDelivery(orderId, errorback) {
    return request._get('/shop/order/order/toDelivery?orderId=' + orderId, {}, errorback)
  },
  //订单发货
  sendToDelivery(data, errorback) {
    return request._postBody('/shop/order/order/delivery/v2', data, errorback)
  },
  // 确认订单
  confirmOrder(data, errorback) {
    return request._postBody('/shop/order/order/confirm', data, errorback)
  },
  // 确认尾款
  confirmBack(data, errorback) {
    return request._postBody('/shop/order/order/confirm/final', data, errorback)
  },
  // 导出订单
  exportOrder(dataType) {
    return httpAxios({
      url: '/shop/order/order/export',
      method: 'post',
      params: {
        ...dataType
      },
      responseType: 'blob'
    })
  },
  // 导出发货单
  deliveryExport(data) {
    return httpAxios({
      url: '/shop/order/delivery/export',
      method: 'post',
      params: data,
      responseType: 'blob'
    })
  },
  exportRefund(orderId) {
    return httpAxios({
      url: '/shop/order/order/exportOutWarehouse',
      method: 'post',
      params: {
        orderId
      },
      responseType: 'blob'
    })
  },
  getWaletList(data, errorback) {
    return request._postBody('/shop/user/wallet/index', data, errorback);
  },
  exportWalet(payStatus) {
    return httpAxios({
      url: '/shop/user/wallet/export',
      method: 'get',
      params: {
        payStatus
      },
      responseType: 'blob'
    })
  },
  // 申请反审
  modifyApply(data, errorback) {
    return request._post('/shop/order/order/modify/apply', data, errorback)
  },
  //订单同步
  orderAsync(orderId, errorback) {
    return request._post('/shop/order/order/sync?orderId=' + orderId, {}, errorback)
  },
  getSkuProducts(data, errorback) {
    return request._postBody('/shop/product/product/pageSku', data, errorback);
  },
  deliveryDetail(data, errorback) {
    return request._get('/shop/order/delivery/detail', data, errorback);
  },
  createOrderNew(data, errorback) {
    return request._postBody('/shop/order/order/shopUserCreate', data, errorback)
  },
  //修改订单
  updateOrderNums(data, errorback) {
    return request._postBody('/shop/order/order/modify', data, errorback)
  },
  //修改订单-财务审核
  updateOrderNumCwAudit(data, errorback) {
    return request._get('/shop/order/order/audit', data, errorback)
  },
  // 财务退款
  refundApply(data, errorback) {
    return request._postBody('/shop/order/refund/finance/apply', data, errorback)
  },
  // 业务端申请退款
  refundApply(data, errorback) {
    return request._postBody('/shop/order/refund/apply', data, errorback)
  },

  imageUpload(file, errorback) {
    return request._upload('/shop/file/upload/image/v2', file, errorback);
  },
  deposiAudit(data, errorback) {
    return request._postBody('/shop/order/order/deposit/audit', data, errorback)
  },
  finalsiAudit(data, errorback) {
    return request._postBody('/shop/order/order/final/audit', data, errorback)
  },
  xszjAudit(data, errorback) {
    return request._postBody('/shop/order/refund/director/audit', data, errorback)
  },
  scjdAudit(data, errorback) {
    return request._postBody('/shop/order/refund/produce/audit', data, errorback)
  },
  orderModifyCalc(data, errorback) {
    return request._postBody('/shop/order/order/modify/calc', data, errorback);
  },
  //基地集合
  productProduceList(data, errorback) {
    return request._get('/shop/product/product/produce/list', data, errorback)
  },
  //审核订单
  orderAuditV2(data, errorback) {
    return request._postBody('/shop/order/order/audit/v2', data, errorback)
  },
  // 变更历史
  modifyHistory(data, errorback) {
    return request._get('/shop/order/order/modify/history', data, errorback);
  },
  // 获取活动类型
  activeTypeList(data, errorback) {
    return request._get('/shop/plus/seckill/active/type/list', data, errorback);
  },
  // 购买券包审核
  vipPackageAudit(data, errorback) {
    return request._postBody('/shop/plus/vipPackage/audit', data, errorback)
  },
  // 上传券包凭证
  vipPackageBuyConfirm(data, errorback) {
    return request._post('/shop/plus/vipPackage/buy/confirm', data, errorback)
  },
  // 订单打印
  orderPrint(data, errorback) {
    return request._get('/shop/order/order/print', data, errorback);
  },
  //下一步流程图
  orderOperate(data, errorback) {
    return request._get('/shop/order/order/operate', data, errorback)
  },

}

export default OrderApi;
